/***banner***/
(function($){  

/** Banner start ******************************************************************************************/
var bannerCfg_hunjie = {
	'index' : 1,//当前显示的banner序号
	'time' : 3000,
	'interval' : null
};
bannerCfg_hunjie.count = $('.index .banner span').length;//banner数量
bannerCfg_hunjie.object = $('#bannerSlider_hunjie');//banner滚动区域对象
//banner滚动效果
bannerCfg_hunjie.show = function(index){
	var width = parseInt(bannerCfg_hunjie.object.parent().width());//banner显示区域宽度
	var position = -width*parseInt(index);//当前banner图片位置
	
	//文字banner样式效果
	$('.index .banner span').removeClass('on');
	$('.index .banner p').hide();
	
	$('.index .banner span[index='+index+']').addClass('on');
	$('.index .banner p[index='+index+']').show();
	
	bannerCfg_hunjie.object.stop(true,false).animate({left:position},500);
	
	if( index == bannerCfg_hunjie.count ){
		$('.index .banner span[index=0]').addClass('on');
		$('.index .banner p[index=0]').show();
		
		setTimeout(function(){
			
			bannerCfg_hunjie.index = 1;
			$('#bannerSlider_hunjie').css('left','0px');
		},500);
	}
	bannerCfg_hunjie.object.attr('index',bannerCfg_hunjie.index);
};
bannerCfg_hunjie.slider = function(){
	bannerCfg_hunjie.show(bannerCfg_hunjie.index);
	bannerCfg_hunjie.index++;
	if(bannerCfg_hunjie.index > 4){
		bannerCfg_hunjie.index = 1;
	}
};
//banner事件绑定
bannerCfg_hunjie.bind = function(){
	bannerCfg_hunjie.interval = setInterval(bannerCfg_hunjie.slider,bannerCfg_hunjie.time);
	
	$('.index .banner span').mouseover(function(){ 
		clearInterval(bannerCfg_hunjie.interval);
		bannerCfg_hunjie.index = $(this).attr('index');
		bannerCfg_hunjie.show(bannerCfg_hunjie.index);
	}).mouseout(function(){
		bannerCfg_hunjie.interval = setInterval(bannerCfg_hunjie.slider,bannerCfg_hunjie.time);
	});
	
	bannerCfg_hunjie.object.hover(function(){
		clearInterval(bannerCfg_hunjie.interval);
	},function(){
		bannerCfg_hunjie.interval = setInterval(bannerCfg_hunjie.slider,bannerCfg_hunjie.time);
	});
};
/** Banner end ******************************************************************************************/
$(document).ready(function(){
	 //banner滚动效果
	 bannerCfg_hunjie.bind();
	 var ol_width = parseInt($(".bannerSlider_ol li").width()*$(".bannerSlider_ol li").length+8*$(".bannerSlider_ol li").length)
	 $(".bannerSlider_ol").css("width",ol_width);
});
})(jQ);

/* 收藏本页 */
function addPageNow(){
	try{
		window.external.AddFavorite(''+document.location.href+'', ''+document.title+'');
	}catch(e){
		alert('当前使用的浏览器不支持自动添加收藏夹，请按Ctrl+D收藏本页面。');
	}
};